#!/bin/bash
#
#**********************************************************************************************
#Author:        Raymond
#QQ:            88563128
#Date:          2022-05-30
#FileName:      /data/scripts/dingding-label-send.sh
#URL:           raymond.blog.csdn.net
#Description:   The test script
#Copyright (C): 2022 All rights reserved
#*********************************************************************************************
#PHONE=$1
#SUBJECT=$2
MESSAGE=$1

secret='SECb142e271e15b0e9affa5417f154928d225cec554a80f4bea26d13e365db32c77'
getkey=$(/usr/bin/python3 /data/scripts/dingding-label-sign.py)
timestamp=${getkey:0:13}
sign=$(echo "${getkey:13:100}" |tr -d '\n')
DateStamp=$(date -d @${getkey:0:10} "+%F %H:%M:%S")

/usr/bin/curl -X "POST" "https://oapi.dingtalk.com/robot/send?access_token=ea8fc7aac8bcbea66639d13ad842681054af55043b20d41faed47d7d42f9c1ba&timestamp=${timestamp}&sign=${sign}" \
-H 'Content-Type: application/json' \
-d '{"msgtype": "text",
   "text": {
        "content": "'${MESSAGE}'"
     }
   }'
